package com.service.impl;

import com.service.magMenuService;

import static com.util.Vessel.manageMenus;
import static com.util.Vessel.scanner;

public class magMenuSerImpl implements magMenuService {
    //添加菜品
    @Override
    public void addMenu() {
        int num = 0;
        System.out.println("请输入新添加菜品名称:");
        String mName = scanner.next();
        System.out.println("请输入新添加菜品价格:");
        double mPrice = scanner.nextDouble();
        num =manageMenus.addMenu(mName,mPrice);
        if (num > 0){
            System.out.println("添加成功!");
        }
    }

    //删除菜品
    @Override
    public void delMenu() {
        int num = 0;
        System.out.println("请输入删除菜品Id");
        int mId = scanner.nextInt();
        num = manageMenus.delMenu(mId);
        if (num > 0){
            System.out.println("删除菜品成功!");
        }
    }

    //更改菜品信息
    @Override
    public void alterMenu() {
        int num = 0;
        System.out.println("请输入要更改的菜品Id");
        int oldmId = scanner.nextInt();
        System.out.println("请输入新设置菜品Id");
        int mId = scanner.nextInt();
        System.out.println("请输入新的菜品名称:");
        String mName = scanner.next();
        System.out.println("请输入新的菜品价格:");
        double mPrice = scanner.nextDouble();
        num = manageMenus.alterMenu(oldmId,mId,mName,mPrice);
        if (num > 0){
            System.out.println("更改菜品信息成功!");
        }
    }
}
